<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="en" data-theme="light">
<head>
    <title>AuthPage</title>
    <link rel="stylesheet" href="<c:url value='/assets/css/output.css'/>">
</head>
<body>

<!-- Ensure requestScope.toAuthPage is set to true, otherwise redirect to home -->
<c:if test="${empty requestScope.toAuthPage}">
    <c:redirect url="/"/>
</c:if>

<!-- Proceed with authentication page content -->
<c:if test="${not empty requestScope.toAuthPage}">
    <c:choose>
        <c:when test="${not empty requestScope.authPage}">
            <!-- Navigation Section -->
            <div class="h-16 bg-base-200">
                <jsp:include page="/include/common/header/web_header.jsp" flush="true"/>
            </div>

            <!-- Main Content Section -->
            <div class="min-h-[calc(100vh-64px)] relative flex items-center justify-center select-none">
                <!-- Background -->
                <jsp:include page="/include/common/display/auth_background.jsp" flush="false"/>

                <!-- Auth Card -->
                <c:set var="authCardTitle" value="登录账号"/>
                <c:set var="authCardType" value="登录"/>

                <!-- Check if authPage is register to set the correct title and type -->
                <c:if test="${requestScope.authPage == 'register'}">
                    <c:set var="authCardTitle" value="注册账号"/>
                    <c:set var="authCardType" value="注册"/>
                </c:if>

                <!-- Include Auth Card Form with Parameters -->
                <jsp:include page="/include/home/auth_card_form.jsp">
                    <jsp:param name="authCardTitle" value="${authCardTitle}"/>
                    <jsp:param name="authCardType" value="${authCardType}"/>
                    <jsp:param name="authRegisterUrl" value="/view/auth/register.jsp"/>
                    <jsp:param name="authLoginUrl" value="/view/auth/login.jsp"/>
                    <jsp:param name="authPage" value="${requestScope.authPage}"/>
                </jsp:include>
            </div>
        </c:when>
    </c:choose>
</c:if>

</body>
</html>
